package com.cheer.vo;

import com.google.common.collect.Maps;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Data
public class OrganizationExportVO {

    private static Map<String, String> headerAlias = Maps.newLinkedHashMap();

    static {
        headerAlias.put("number", "序号");
        headerAlias.put("orgName", "组织机构名称");
        headerAlias.put("parentOrgName", "上级单位");
        headerAlias.put("applied", "已申请文明号");
        headerAlias.put("awarded", "已获得国家级/省级/市级文明号");
    }

    private String number;

    private String orgName;

    private String parentOrgName;

    private Integer applied;

    private String awarded;

    public static Map<String, String> getHeaderAlias() {
        return headerAlias;
    }

    public static List<OrganizationExportVO> buildList(List<OrganizationPageVO> organizationPageVOS) {
        List<OrganizationExportVO> organizationExportVOS = new ArrayList<>();
        for (int i = 0; i < organizationPageVOS.size(); i++) {
            OrganizationPageVO organizationPageVO = organizationPageVOS.get(i);
            OrganizationExportVO organizationExportVO = new OrganizationExportVO();
            organizationExportVO.setNumber(String.valueOf(i + 1));
            organizationExportVO.setOrgName(organizationPageVO.getOrgName());
            organizationExportVO.setParentOrgName(organizationPageVO.getParentOrgName());
            organizationExportVO.setApplied(organizationPageVO.getApply());
            organizationExportVO.setAwarded(organizationPageVO.getNation() + "/" + organizationPageVO.getProvince() +
                    "/" + organizationPageVO.getCity());
            organizationExportVOS.add(organizationExportVO);
        }
        return organizationExportVOS;
    }
}
